package com.example.erhuo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.erhuo.Good;
import com.example.erhuo.LikeInformation;
import com.example.erhuo.R;
import com.example.erhuo.WantOrder;

import java.util.LinkedList;

public class WantOrderAdapter extends BaseAdapter {
    private LinkedList<WantOrder> mData;
    private Context mContext;

    public WantOrderAdapter(LinkedList<WantOrder> mData, Context mContext) {
        this.mContext = mContext;
        this.mData = mData;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_want, parent, false);
        }
        TextView txt_title = (TextView) convertView.findViewById(R.id.want_title);
        TextView txt_price = (TextView) convertView.findViewById(R.id.want_price);
        TextView txt_sender = (TextView) convertView.findViewById(R.id.want_sender);
        WantOrder order = mData.get(position);
        txt_price.setText(order.getPrice());
        txt_title.setText(order.getTitle());
        txt_sender.setText(order.getSenderId());
        return convertView;
    }

    public void addWant(WantOrder order) {
        mData.add(order);
    }
}
